package base.hash;

import java.util.HashSet;
import java.util.Random;

public class JmhbUtils {
	private static HashSet<String> set = new HashSet<>();
	
	/**
	 * 一共发行100个
	 */
	private static final int LENTH = 10;
	
	/**
	 * 字符最小值
	 */
	private static final int MINCHAR = 48;
	/**
	 * 字符最大值
	 */
	private static final int MAXCHAR = 122;
	
	/**
	 * 最长256位
	 */
	private static final int MAXLEN = 0b1111_1111;
	
	public static HashSet<String> getAllJmhb(){
		Random r = new Random(System.currentTimeMillis());
		for(int i=1;i<=LENTH;i++) {
			//计算字符串长度
			int len = r.nextInt(MAXLEN);
			//System.out.println(len);
			char[] cArray = new char[len];
			for(int j=0;j<=len-1;j++) {
				cArray[j] = (char)(MINCHAR+(int)(Math.random()*(MAXCHAR-MINCHAR)));
			}
			System.out.println(String.valueOf(cArray));
			set.add(Sha256Main.getSHA256Str(String.valueOf(cArray)));
		}
		for (String string : set) {
			System.out.println(string);
		}
		return set;
	}
	
}
